aux_source_directory(. SRC_DIR)

include_directories(/opt/include)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

add_executable(magtet ${SRC_DIR})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -O3")

find_library(GCTL_LIBRARY gctl /usr/local/lib)
target_link_libraries(magtet PUBLIC ${GCTL_LIBRARY})

find_package(OpenMP REQUIRED)
if (OpenMP_CXX_FOUND)
    message(STATUS "OpenMP Found.")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
    target_link_libraries(magtet PUBLIC OpenMP::OpenMP_CXX)
endif()

# 将可执行程序安装到/opt/stow/yzToys
install(TARGETS magtet RUNTIME DESTINATION bin)